This invention relates to keyboard scancode processing.
A computer operator may wish to control her computer's audio functions, e.g., volume, bass, treble or spatializer. While analog dials are sometimes available for audio control, control via hotkeys is more flexible and cheaper to manufacture. Controlling audio functions through keyboard hotkeys is relatively simple. A "hotkey" comprises a control, alt or shift key ("function key") and another key, which, when depressed simultaneously, trigger execution of a previously-defined routine in, e.g., a Terminate & Stay Resident (TSR) Program for controlling the appropriate audio function. Examples of hotkeys could include &lt;alt&gt;-v for volume control, and &lt;cntrl&gt;-&lt;alt&gt;-b for bass control.
The details of how audio functions are controlled by hotkeys is more complex. When the operator presses a key, the keyboard generates a keyboard scancode. In response to the keyboard scancode, the keyboard controller connected to the keyboard raises a keyboard interrupt (IRQ) line connected to one of two Programmable Interrupt Controllers (PICs). By default, under normal operation, this keyboard interrupt line is the second line (IRQ 1) attached to the first PIC. The PIC, upon realizing that IRQ 1 is active, is programmed to generate an interrupt vector number--by default, interrupt vector number 9hex that corresponds to IRQ 1. This interrupt vector number is then transferred to the main CPU. When the CPU receives the interrupt vector number, it looks up the interrupt vector address corresponding to the interrupt vector number and calls the interrupt service routine (ISR) pointed to by the interrupt vector address. For the computer's audio functions, the interrupt service routine would check to see whether one of the computer's hotkeys had been pressed, and if so, would perform one of the computer's audio functions.
With certain DOS applications, however, particularly including video games, when the game is loaded into the computer, the program in essence commandeers the input from the keyboard for its own purposes and prevents the operator from controlling the audio by preventing the audio control routines from ever seeing the keyboard hotkey commands. To do this, the new program replaces the keyboard interrupt vector, stored by the ROM BIOS or DOS TSR program when the computer was initially booted, with a vector pointing to the new program's own interrupt service routine (ISR). Because there is no way to guarantee that the new program's ISR will include, as part of its routine, execution of the old ISR, the old ISR that would otherwise have controlled the computer audio is effectively disabled.